﻿package kliment.utils {
	import flash.ui.Keyboard;
	
	/**
	 * ...
	 * @author Kliment
	 * 
	 * class name: kliment.utils.FileType
	 */
	public class FileType {
		public static const UNKNOWN:String = "unknown";
		public static const FLV:String = "flv";
		public static const F4V:String = "f4v";
		public static const JPG:String = "jpg";
		public static const JPEG:String = "jpeg";
		public static const PNG:String = "png";
		public static const GIF:String = "gif";
		public static const SWF:String = "swf";
		public static const MP3:String = "mp3";
		public static const TXT:String = "txt";
		public static const HTML:String = "html";
		
		public static function defineType(file:String):String {
			var extension:String = '';
			var type:String = file.substring(file.lastIndexOf('.', file.length - 1) + 1, file.length);
			switch (type) {
				case FLV: extension = FLV; break;
				case F4V: extension = F4V; break;
				case JPG: 
				case JPEG: extension = JPG; break;
				case PNG: extension = PNG; break;
				case GIF: extension = GIF; break;
				case MP3: extension = MP3; break;
				case HTML: extension = HTML; break;
				case TXT: extension = TXT; break;
				default: extension = UNKNOWN; break;
			}
			
			return extension;
		}
	}
	
}